﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class OnToggleEvent : MonoBehaviour {

    private Toggle toggle = null;
    public string onValueChange = "";

    void Start () {
        this.toggle = this.gameObject.GetComponent<Toggle>();
        if (toggle != null) {
            this.toggle.onValueChanged.AddListener(valueChange);
        }
	}
	
	void Update () {
		
	}

    void valueChange(bool value) {
        MonoBehaviour.print("on Toggle value change value:" + value);
        if (this.onValueChange != "")
        {
            LuaHelper.getLuaModule().callScript(onValueChange, value);
        }
    }

}
